<template>
  <div>
    <h3>Requester</h3>
    <p>loading {{ loading }}</p>
    <p>data {{ data }}</p>
    <p>err {{ err }}</p>
    <div>
      <button @click="ajax">发起请求</button>
      <button @click="cancel">取消请求</button>
    </div>
  </div>
</template>

<script setup>
import useRequest from "../hooks/useRequest";

const { loading, data, err, ajax, cancel } = useRequest(
  "http://127.0.0.1:5173/data.json",
  false
);
</script>

<style lang="scss" scoped></style>
